package com.yousu.dashijixm.anno;

import com.yousu.dashijixm.validation.StateValidation;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import jakarta.validation.constraints.NotEmpty;

import java.lang.annotation.*;

/**
 * 自定义注解，用于Validated校验
 */

@Documented //元注解
@Constraint(
        validatedBy = {StateValidation.class}
)
//元注解，该注解可以用在什么地方，方法、属性等
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
//元注解，在那个阶段保留
@Retention(RetentionPolicy.RUNTIME)
public @interface State {
    String message() default "{文档状态只能的已发布或草稿}";//报错返回的信息

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
